import 'package:flutter/material.dart';

void main() => runApp(MyApp(
    items: List<String>.generate(1000, (index) => 'Item $index')
));

class MyApp extends StatelessWidget{

  final List<String> items;
  // MyApp({Key? key, required this.items}):super(key:key);
  MyApp({required this.items});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'List View Widget',
      home: Scaffold(
          appBar: AppBar(
            title: const Text('List View Widget'),
          ),
          body: ListView.builder(
            itemCount: items.length,
            itemBuilder: (context, index) {
              return ListTile(
                title: Text(items[index]),
              );
            },
          )
      ),
    );
  }
}

class MyList extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return ListView(
      scrollDirection: Axis.horizontal,
      children: <Widget>[
        Container(
          width: 180,
          color: Colors.lightBlue,
        ),
        Container(
          width: 180,
          color: Colors.yellow,
        ),
        Container(
          width: 180,
          color: Colors.greenAccent,
        ),
        Container(
          width: 180,
          color: Colors.red,
        ),
      ],
    );
  }
}